import {
  publishArticle,
  getArticleDetails,
  editPublishArticle,
} from '@/api/publish';

export const publishArticleAction = (data, isDraft = false, isEdit) => {
  return async () => {
    if (isEdit) {
      await editPublishArticle(data, isDraft);
    } else {
      await publishArticle(data, isDraft);
    }
  };
};

export const getArticleDetailsAction = articleId => {
  return async () => {
    const res = await getArticleDetails(articleId);
    return res.data.data;
  };
};
